package com.lagou.worker.controller;

import com.lagou.worker.service.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName CodeController
 * @Description TODO
 * @Author xsq
 * @Date 2020/7/28 16:20
 **/
@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private MailService mailService;

    /**
     * 把验证码发送到邮箱
     * @param email
     * @param code
     * @return
     */
    @GetMapping("/sendEmail/{email}/{code}")
    public ResponseEntity<Boolean> sendEmail(@PathVariable("email") String email,@PathVariable("code") String code) {
        mailService.sendEmail(email,code);
        return ResponseEntity.ok(true);
    }




}
